home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / redtop / entpass.frm next >
Text File  |  1994-11-27  |  4KB  |  149 lines

  1. VERSION 2.00
  2. Begin Form frmEnterPass 
  3.    BorderStyle     =   3  'Fixed Double
  4.    ClientHeight    =   2265
  5.    ClientLeft      =   1065
  6.    ClientTop       =   1515
  7.    ClientWidth     =   4095
  8.    ControlBox      =   0   'False
  9.    Height          =   2670
  10.    Left            =   1005
  11.    LinkTopic       =   "Form2"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   2265
  15.    ScaleWidth      =   4095
  16.    Top             =   1170
  17.    Width           =   4215
  18.    Begin Timer Timer1 
  19.       Enabled         =   0   'False
  20.       Interval        =   30000
  21.       Left            =   2220
  22.       Top             =   1680
  23.    End
  24.    Begin CommandButton cmdCancel 
  25.       Cancel          =   -1  'True
  26.       Caption         =   "Cancel"
  27.       Height          =   375
  28.       Left            =   2820
  29.       TabIndex        =   2
  30.       Top             =   1740
  31.       Width           =   1095
  32.    End
  33.    Begin CommandButton cmdOK 
  34.       Caption         =   "OK"
  35.       Default         =   -1  'True
  36.       Height          =   375
  37.       Left            =   720
  38.       TabIndex        =   1
  39.       Top             =   1740
  40.       Width           =   1095
  41.    End
  42.    Begin TextBox txtPassword 
  43.       Height          =   285
  44.       Left            =   1860
  45.       MaxLength       =   20
  46.       PasswordChar    =   "*"
  47.       TabIndex        =   0
  48.       Top             =   1260
  49.       Width           =   2055
  50.    End
  51.    Begin Label Label2 
  52.       Caption         =   "Password:"
  53.       Height          =   195
  54.       Left            =   720
  55.       TabIndex        =   4
  56.       Top             =   1320
  57.       Width           =   975
  58.    End
  59.    Begin Label Label1 
  60.       Caption         =   "The screen saver you are using is password protected. You must type in the screen saver password to turn off the screen saver."
  61.       Height          =   855
  62.       Left            =   720
  63.       TabIndex        =   3
  64.       Top             =   120
  65.       Width           =   3255
  66.    End
  67.    Begin Image imgIcon 
  68.       Height          =   480
  69.       Left            =   120
  70.       Picture         =   ENTPASS.FRX:0000
  71.       Top             =   120
  72.       Width           =   480
  73.    End
  74. End
  75. Option Explicit
  76.  
  77. Dim FirstTime As Integer
  78.  
  79. Sub cmdCancel_Click ()
  80.     ValidPassword = 2 ' Password canceled
  81.     Unload Me
  82. End Sub
  83.  
  84. Sub cmdOK_Click ()
  85.     
  86.     If CalcPassnum(UCase$(txtPassword.Text)) = Password Then
  87.         ValidPassword = 1 ' Password valid
  88.     Else
  89.         ValidPassword = 3 ' Password invalid
  90.     End If
  91.     Unload Me
  92. End Sub
  93.  
  94. Sub Form_Activate ()
  95.  
  96.     If FirstTime Then
  97.         FirstTime = False
  98.         txtPassword.SetFocus
  99.     End If
  100.  
  101. End Sub
  102.  
  103. Sub Form_Load ()
  104.     
  105.     Dim i As Integer
  106.     FirstTime = True
  107.     Caption = SaverName
  108.     CentreForm Me
  109.     ValidPassword = 0 ' Set to a known value
  110.     timer1.Enabled = True ' Start the timer
  111.     ' Set the Form to be TopMost
  112.     SetWindowPos Me.hWnd, -1, 0, 0, 0, 0, 3
  113.     ' Set the Form to be System Modal (Ouch!)
  114.     i = SetSysModalWindow(hWnd)
  115.  
  116. End Sub
  117.  
  118. Sub Form_Unload (Cancel As Integer)
  119.     
  120.     timer1.Enabled = False ' Cancel the timer explicitly
  121.     '
  122.     ' If Alt-F4 or the control box is clicked then
  123.     ' set ValidPassword to Canceled
  124.     '
  125.     If ValidPassword = 0 Then ValidPassword = 2
  126.  
  127. End Sub
  128.  
  129. Sub Timer1_Timer ()
  130.     '
  131.     ' if we have had no activity for 30 seconds then
  132.     ' let the screen saver get on with it.
  133.     '
  134.     Unload Me
  135. End Sub
  136.  
  137. Sub txtPassword_KeyPress (KeyAscii As Integer)
  138.     
  139.     '
  140.     ' The user has typed something so reset the counter
  141.     ' to 30 seconds and start counting again
  142.     '
  143.     timer1.Enabled = False
  144.     timer1.Interval = 30000
  145.     timer1.Enabled = True
  146.  
  147. End Sub
  148.  
  149.